package cn.hexcloud.dga.governance.mapper;

import cn.hexcloud.dga.governance.bean.GovernanceAssessGlobal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 治理总考评表 Mapper 接口
 * </p>
 *
 * @author jiangdan7
 * @since 2023-09-11
 */
@Mapper
public interface GovernanceAssessGlobalMapper extends BaseMapper<GovernanceAssessGlobal> {
    @Select("select\n" +
            "    assess_date,  \n" +
            "    avg(  score_spec ) score_spec ,\n" +
            "    avg(  score_storage ) score_storage ,\n" +
            "    avg(  score_calc ) score_calc ,\n" +
            "    avg(  score_quality ) score_quality ,\n" +
            "    avg(  score_security ) score_security ,\n" +
            "    avg(  score )  score   ,\n" +
            "    sum(table_num) table_num,\n" +
            "    sum(problem_num) problem_num,\n" +
            "    now() create_time" +
            "  from  governance_assess_tec_owner ad where assess_date= #{assessDate} ")
    public List<GovernanceAssessGlobal> calcAssess(@Param("assessDate") String assessDate );

}
